<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<html>
<head>
    <meta charset="UTF-8">
    <title>...</title>

    <title>Document</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
          integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css"
          integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
            integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd"
            crossorigin="anonymous"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.params.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        table{
            border: 1px solid dodgerblue;
            text-align: center;
        }
        td{
            border:1px solid dodgerblue;
            width: 200px;
        }
        #sentForm table{
            text-align: left;
            margin-top: 50px;
        }
        #sentForm td{
            width: 400px;
        }
    </style>
</head>
<body>
<table>
    <tr><td colspan="6" bgcolor="#1e90ff" align="left"><b>列表显示</b></td></tr>
    <tr>
        <td><b>编号</b></td>
        <td><b>板块名称</b></td>
        <td><b>标题</b></td>
        <td><b>发布人</b></td>
        <td><b>发表时间</b></td>
        <td><b>操作</b></td>
    </tr>
    <tbody id="tb"></tbody>
</table>
<form action="#" id="sentForm">
    <table>
        <tr>
            <td>标题：<input type="text" id="titleContent"/></td>
            <td>发表人：<input type="text" id="pubAuthor"/></td>
            <td>发表时间：<input type="date" id="pubTime"/></td>
        </tr>
        <tr>
            <td colspan="3">
                选择所属板块：<select>
                <option value="1">JSP编程技术</option>
                <option value="2">JAVA编程技术</option>
                <option value="3">HTML网页技术</option>

            </select>
            </td>
        </tr>
        <tr>
            <td colspan="3" >内容：</td>
        </tr>
        <tr>
            <td colspan="3">
                <textarea id="msgContent" name="msgContent"></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="3" align="center">
                <button type="button">修改</button>
                <button type="reset">返回</button>
            </td>
        </tr>
    </table>
</form>

</body>
</html>
<script>
    $(function () {
        getAll();
    })
    function getAll() {
        $.get("/getAll.do",function (data) {
            $("#tb").html("");
            console.log("data:",data);
            let str="";
            data.forEach(all=>{
                str += "<tr>";
                str += "<td>"+all.tid+"</td>";
                str += "<td>"+all.publisherName+"</td>";
                str += "<td>"+all.titleContent+"</td>";
                str += "<td>"+all.pubAuthor+"</td>";
                str += "<td>"+all.pubTime+"</td>";
                str += "<td>";
                str += "<botton onclick='update("+all.tid+","+all.publisherName+")'>修改</botton>";
                str += "</td>";
                str += "</tr>";
            })
            $("#tb").html(str);
        });
    }
    function update(tid,publisherName) {
        console.log(tid,publisherName)
    }
</script>